const fastify = require('fastify')({ logger: true })
const Agent = require('./agent')

const agent = new Agent()

// Declare a route
fastify.get('/nodeInfo', async (request, reply) => {
    return agent.getData()
})

// Run the server!
const start = async () => {
    try {
        await agent.init()
        await fastify.listen(8499)
    } catch (err) {
        fastify.log.error(err)
        process.exit(1)
    }
}
start()